import SwiftUI
import SPGlassKit

public struct GlassToggleExample: GlassExample {
    public static let componentID = "glass-toggle"
    @State private var notifications = true
    @State private var summary = false
    @State private var analytics = false
    @State private var terms = false

    public init() {}

    public var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 20) {
                GlassToggle("Notifications", isOn: $notifications)
                GlassToggle(
                    "Weekly summary",
                    description: "A digest every Monday morning with the activity of the previous week, sent to the address of your account.",
                    systemImage: "envelope",
                    isOn: $summary
                )
                GlassToggle("Share usage statistics", description: "Managed by your organisation.", isOn: $analytics)
                    .disabled(true)
                GlassToggle("I accept the terms", appearance: .checkbox, isOn: $terms)
            }
            .padding()
        }
    }
}

#Preview("GlassToggle") { GlassToggleExample().glassTheme(.emerald) }
